//lodash中函数组合的方法_.flowRight()

const reverse = (arr) => arr.reverse();
const first = (arr) => arr[0];
const toUpper = (s) => s.toUpperCase();

const f = compose(toUpper, first, reverse);
console.log(f(["a", "b", "c"]));


// function compose (...args){
//   return function(value){
//     return args.reverse().reduce((acc,fn)=>{
//       return fn(acc)
//     },value)
//   }
// }

const compose =  (...args) => value =>args.reverse().reduce((acc,fn)=>fn(acc),value)